#import "SSZipArchive.h"
#import "PubgLoad.h"
#import <UIKit/UIKit.h>
#import "JHPP.h"
#import "JHDragView.h"
#import "SCLAlertView.h"
#import "LSTPopView.h"
#import "LSTPopViewrRSidebarView.h"
#import "LSTGestureEvents.h"
#import "CDModelClick.h"
#import "LWJRModelFunc.h"
#import "UrlModel.h"
#import "MJEncryptStringData.h"

#define Navi_Height ([UIApplication sharedApplication].statusBarFrame.size.height+44)

#define statusHeight [UIApplication sharedApplication].statusBarFrame.size.height

// MainScreen Height&Width
#define Main_Screen_Height      [[UIScreen mainScreen] bounds].size.height

#define Main_Screen_Width       [[UIScreen mainScreen] bounds].size.width


@interface PubgLoad()
@property (nonatomic, strong) dispatch_source_t timer;

@property (nonatomic, strong) LSTPopViewrRSidebarView *sideView;

@property (nonatomic, strong) LSTPopView *popView;




@end

@implementation PubgLoad

static PubgLoad *extraInfo;
static BOOL MenDeal;

+ (void)load
{
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(6* NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        extraInfo =  [PubgLoad new];
        [extraInfo initTapGes];
        [extraInfo tapIconView];
    });
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(400 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        
        exit(0);
    });
    
    
}

-(void)initTapGes
{
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] init];
    tap.numberOfTapsRequired = 3;//点击次数
    tap.numberOfTouchesRequired = 3;//手指数
    [[JHPP currentViewController].view addGestureRecognizer:tap];
    [tap addTarget:self action:@selector(tapIconView)];
}

-(void)tapIconView
{
    JHDragView *view = [[JHPP currentViewController].view viewWithTag:100];
    
    if (!view) {
        
        view = [[JHDragView alloc] init];
        view.tag = 100;
        
        [[JHPP currentViewController].view addSubview:view];
        
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onConsoleButtonTapped:)];
        tap.numberOfTapsRequired = 1;
        [view addGestureRecognizer:tap];
        
    }
    
    if (!MenDeal) {
        view.hidden = NO;
    } else {
        view.hidden = YES;
    }
    
    MenDeal = !MenDeal;
}

-(void)onConsoleButtonTapped:(id)sender
{
    
    
    __weak typeof(self) weakSelf = self;
    
    if (_sideView) {
        
        
    } else {
        
        [CDModelClick sharepayManger].startFan = @"0x100000000";
        [CDModelClick sharepayManger].endFan = @"0x160000000";
        [CDModelClick sharepayManger].nearbyFan = @"0x20";
        
        self.sideView = [[LSTPopViewrRSidebarView alloc] initWithFrame:CGRectMake(0, 0, 180,260)];
        self.sideView.titleArr = @[mj_OCString(_1722917488),mj_OCString(_3867101821),mj_OCString(_1105022233)];
        self.sideView.lable5.text = mj_OCString(_162568979);
        self.sideView.lable4.text = mj_OCString(_3380035714);
        
        self.sideView.diBlock = ^(id  _Nonnull res) {
            
            [weakSelf.popView dismiss];
        };
        
        self.popView = [LSTPopView initWithCustomView:self.sideView
                                           parentView:[UIApplication sharedApplication].keyWindow
                                             popStyle:LSTPopStyleSpringFromRight
                                         dismissStyle:LSTDismissStyleSmoothToRight];
        self.popView.hemStyle = LSTHemStyleRight;
        self.popView.avoidKeyboardSpace = -150;
        self.popView.groupId = @"小K助手";
  
        if (Main_Screen_Width > 667) {
            
            self.popView.adjustX = -44;
        }
      
        self.popView.popDuration = 0.5;
        self.popView.bgAlpha = 0.0;
        self.popView.dismissDuration = 0.5;
        self.popView.isClickFeedback = YES;
        self.popView.bgClickBlock = ^{
            NSLog(@"点击了背景");
            [weakSelf.popView dismiss];
        };
        
    }
    
    [self.popView pop];
    
    
}



@end
